#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(int argc, char **argv)
{
    struct stat file_stat;
    struct tm file_tm;
    char time_str[100];
    int ret;

    if(argc > 1){
        printf("The number of files entered was not what was expected!\n");
        exit(-1);
    }

    printf("file name: %s\n", argv[1]);

    localtime_r(&file_stat.st_atim.tv_sec, &file_tm);
    strftime(time_str, sizeof(time_str), "%Y-%m-%D, %H:%M:%S", &file_tm);
    printf("time of last access: %s\n", time_str);

    localtime_r(&file_stat.st_mtim.tv_sec, &file_tm);
    strftime(time_str, sizeof(time_str), "%Y-%m-%d, %H:%M:%S", &file_tm);
    printf("time of last modification: %s\n", time_str);

    localtime_r(&file_stat.st_ctim.tv_sec, &file_tm);
    strftime(time_str, sizeof(time_str), "%Y-%m-%d, %H:%M:%S", &file_tm);
    printf("time of last status change: %s\n", time_str);

    exit(0);
}